Chapter 2
 The Grand Tour: Language
 t Overview of the Prograph
         Development System
 t Your First End-user Experience
 t Your First Method
 t Your First Class
 t Congratulations

During the Grand Tour you:

q start up Prograph and run an application with its full Macintosh interface

q use Prograph’s graphical editor to create your first method

q create a new Prograph class with its own attributes and methods

By following the Grand Tour you are introduced to the “big picture” of the Prograph development environment. You experience most of the powerful features that distinguish object-oriented and dataflow programming from traditional means of writing software. The objective is for you to become familiar with as much of the Prograph development environment as possible without stopping for detailed explanations. 

Don’t worry or get bogged down if you do not understand everything you read or do during the Grand Tour. Once you have a feel for the Prograph development environment, you can work through examples in Part 2, “Tutorials,” that can help you understand Prograph in much greater detail. 

The amount of time you choose to spend on the Grand Tour will probably depend on your prior programming experience and basic personality. With this in mind, we provide two different approaches to the Grand Tour*393*—a Quick Grand Tour and a Complete Grand Tour. Both take you quickly around the Prograph development environment, but the Quick Grand Tour ignores descriptive text, notes, and tips. Take either version of the Grand Tour to get you started. 
To take the Quick Grand Tour:*397*

u
Focus on instructions preceded with bullets. These step you through a series of explicit activities that tell you exactly what to do to complete the Grand Tour.

u
Pay attention to screen shots and other pictures that show you what you should see on your own display as you progress through the Tour.

u
Skim or ignore text that does not have a bullet, especially the tips and notes in boxes.
To take the*395* Complete Grand Tour:*179**393*

u From here on, read everything and follow each instruction in this chapter.

As you move through whichever Grand Tour version you select to use, remember the purpose here is to give you a taste of Prograph. Understanding will come as you progress through Part 2, “Tutorials”.

t
Overview of the Prograph Development System

Prograph is a completely integrated software-development system. It provides a very high-level pictorial language and a full set of tools for building applications. Prograph consists of a powerful editor, interpreter, and compiler.

In this Grand Tour chapter, you explore the language component of Prograph and use the Prograph editor. In chapter 3, the Grand Tour continues as you explore Prograph’s Application Builder to build your first application.

For a full discussion of the Prograph Development System*890* and the conceptual foundations of the Prograph language, please see chapter 4. For now, move on to the Grand Tour and your first end-user experience.

t
Your First End-user Experience

u Turn on your Macintosh and open the folder containing your Prograph working files on the desktop. If you have not yet installed Prograph, see instructions for doing so in the “Introduction” chapter.

The Prograph application icon *418**879*you see in the icon view of the desktop is shown below left. To the right is a *891*Prograph document file icon. *419* Prograph documents store programs written in Prograph.

u Locate the Health Monitor Application file in the Tutorial Examples ƒon your disk.

u
Double-click on this file to launch Prograph.

A watch cursor and progress dialog will display while Prograph is launching.  After Prograph's menus appear, select Run Grand Tour from the Exec menu, as shown:

This causes Prograph to run the Health Monitor Application, while the graphical editor of Prograph's interpreter environment waits unseen in the background.  When the Health Monitor Application has loaded and starts running, your screen displays what you see in the following figure.  Clicking anywhere on the Welcome window dismisses the window.

The Health Monitor Application is a personal health program designed to help its users monitor their weight, food consumption, and exercise. In addition to tracking this information in a simple database, the Health Monitor Application performs some basic analyses of the data. This sample application shows you a complete Macintosh interface *554* written in Prograph. 

u Take a few minutes to explore the application. Try each item in the menus of the menu bar.
In the windows that appear you see Macintosh interface controls that are familiar to you. 

These interface conventions are not arbitrary. Prograph applications are consistent with the conventions recommended in *405*Human Interface Guidelines: *31*The Apple Desktop Interface (1987) *30*, the standard source for producing universally acceptable application interfaces.

As you explore the Health Monitor Application, notice the multiple overlapping custom windows and pull-down menus.

There are custom dialogs with buttons, editable text, scrolling lists, and radio buttons—all the familiar Macintosh interface conventions. Each of these controls, and more, are available to you in Prograph’s Application Builder.*49*

While Prograph is a radically innovative development environment, your Prograph applications will look and feel just like all other Macintosh applications. Here is a taste of how you do it.

t
Your First Method

u Select Quit from the File menu of the Health Monitor Application.
Instead of returning to your Macintosh desktop, the Health Monitor Application quits to the Prograph development environment. The Health Monitor menu bar is replaced by the standard menus that control the Prograph graphical editor and interpreter. 

u Select New from the File menu. Click Discard in the Save program file “Health Monitor Application”? dialog.

The Universal methods*692* and Classes windows open. Prograph is fully object-oriented as well as operation-oriented. Objects are available for all the situations in which object-oriented programming makes sense. Universal methods are available for those times when objects are not required.

___________________________________________________________
NOTE: Prograph supports a procedural*869* or algorithmic*852* style of programming as well as an object-oriented programming approach.*865**773*  The dataflow *898**235*and pictorial features of the Prograph language are used for specifying both universal*1119* methods and object-oriented methods designed within classes.

Scientific*966*, mathematical*566*, and text-handling types of applications are among those in which object-orientation is not required. In a mathematical application, abstract numerical models can provide greater logical structure than objects. This does not mean you cannot or should not write mathematical programs that are object-oriented, but merely that you should have a choice. Prograph gives you the flexibility to use whichever programming methodology you prefer. In fact, you can mix operational and object-oriented approaches in the same application. For example, universal methods can be called upon by many methods*678* within a number of classes in an object-oriented application.
-----------------------------------------------------------

A First Look at the Dataflow Method Editor

A classic non-object-oriented programming task gets you started using Prograph: 

u Select Options from the Info menu. Make sure that the checkbox next to the first option, Cmd-click to create Prograph objects, is on. Click Save Settings to dismiss the dialog. 

u Move the mouse so that the pointer is positioned anywhere within the white space of the Universal  Methods window*1123*. Holding down the Comand key, click once.  This is called a Command-click. An unnamed *413**687* method icon appears where you clicked. 

u Type greetings to name the method.

___________________________________________________________
NOTE: Prograph is upper- and lower-case character sensitive. The names greetings, Greetings, and greeTings.are considered to be different.
-----------------------------------------------------------

u Double-click on the greetings method icon to open its case window.*140*

___________________________________________________________________________________________________________________________________________
NOTE: The method icon has a stacked appearance to show that a method can consist of more than one case. *126*Multiple cases *134*within a method can be specified to handle various conditions under which a method is executed. For now, the methods of the Grand Tour are simple, having only a single case.
-----------------------------------------------------------

u The case window title shows that this is case one of one case for the greetings method.

When you open a case window to develop a method, you enter the dataflow realm of Prograph. Methods are specified in a high-level dataflow pictorial language*899*. Each icon has syntactic meaning—the “pictures” are the language. The Prograph graphical editor makes *994* specification of methods easy and ensures that your methods are syntactically correct.

u Command-click midway in the greetings case window, between the input bar  *484*and output bar  *813*(the horizontal shaded bars at top and bottom) of the method. An unnamed Prograph*791* operation  *910*icon*416* appears.

u Select*636* Info… *448*from the*633* Info menu.*435* The Info… dialog appears. Below the title bar, in the upper left corner of the Info… dialog, is the *577*Category pop-up menu  *149*that displays various categories of information. Pull down the Category pop-up menu to see the many online help facilities available in Prograph. 

u Click on*469* Primitives *849*to select it from the Category pop-up menu. Scroll the list until you locate the*784* primitive  *846*show and click to select it. Brief information concerning the inputs, outputs, and function of this operation is provided.

u Select*466* *1112*Name from the*661* *1107*Transfer pop-up menu *470*to paste the name of this primitive into the generic operation icon of your greetings method case window.

u Note that the greetings case window is now in front of the Info window. Close the Info window, or, if you have a large monitor, move it out of the way.

___________________________________________________________
NOTE: A Prograph Info window is modeless, and must be explicitly dismissed by selecting the Info window and clicking on its close box.
-----------------------------------------------------------

u Press Return. The Prograph editor recognizes the show primitive. It specifies this primitive correctly with a round terminal  *1063*at the top middle of the operation icon. This lets you know that show needs input before it can execute.

u To provide input for show, define a constant  *189*and a datalink  *250*for connecting it to show. Prograph provides useful shortcuts for method specification. A constant and a datalink can be added simultaneously by double-clicking on the terminal of an operation. Move the crosshair cursor  over the terminal of the show operation. Note that when directly over the terminal, the pointer turns into an arrow. Now double-click. The show operation terminal is now connected to the root  *953*of an unspecified constant, which appears with a NULL value. When the operation is executed, the value of the constant flows through the root down the datalink. 

u Type Hello, World! and press Tab or Return to set the value*1140* of this constant to the text string*1075* you just typed. The beginning of the string is displayed followed by an ellipsis*313*, indicating that there is more to the string than is displayed.

===========================================================
*1016*TIP: Pressing Tab in a case window highlights operations in the order in which they execute. When the output bar is already highlighted and Tab is pressed, it wraps around back to the input bar and begins cycling through the execution order again.

Using Tab to preview*1093* execution order *356*is helpful when you start writing complex methods. Unlike sequential execution in traditional programming languages, Prograph’s dataflow language is *895*data-driven. This means that the only prerequisite to an operation executing in Prograph is that its input-data values be available at the input terminals of the operation when it begins to execute. If data is being generated elsewhere, the values must have already arrived along the datalinks. In this simple method, tabbing reveals that the string data value must be generated by the constant operation before the show operation can execute.
===========================================================

u Select*617**681* Execute Method *336*from the Exec (Execution) menu *348*to execute greetings.

A simple dialog box with the Hello, World! greeting appears.

u Press Return or click the OK button to dismiss the dialog and return to the Prograph editor. 

___________________________________________________________
NOTE: By default the Method Execution: Close Windows check box in the Options… panel, accessed through the Info menu, is unchecked. This means that when you execute a method, any existing editor windows remain on screen. If you would like your editor windows to disappear when executing methods, giving you an uncluttered screen, check this option. The down side of checking this option is the amount of activity involved in hiding and restoring editor windows before and after you execute a method.
-----------------------------------------------------------

Technically, you have written a complete application, although a very simple one. It has no menus or menu items in the menu bar. It has no windows or other interactive interface, nor does it have any function other than the dialog it displays. In typical Macintosh fashion, it can only be terminated when you dismiss the dialog by pressing Return or clicking OK.

You have seen that universal methods*1120*, like greetings, can be executed directly. To see how they can be called from methods within classes when you use the object-oriented features of Prograph, proceed with the Grand Tour.